package Test2;

public class Student {
    private String name;
    private int age;

    // 无参数构造方法
    public Student() {
    }

    // 带参数的构造方法
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    // name的setter和getter方法
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    // age的setter和getter方法
    public void setAge(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    // 重写toString方法，方便打印学生信息
    @Override
    public String toString() {
        return name + "，" + age;
    }
}
